<?php

abstract class Cat_Processor_Monkey_TagBase extends Cat_ParamHolder implements Cat_Processor_Monkey_TagInterface
{
	private $processor;

	function __construct( Cat_Processor_Interface $processor )
	{
		$this->processor = $processor;
		$processor->cloneParams( $this );
	}

	function getProcessor()
	{
		return $this->processor;
	}

	function getBody()
	{
		return $this->getParam( 'args' );
	}

	function cloneSettings( Cat_Processor_Monkey_TagInterface $tag )
	{
		return $this->cloneParams( $tag );
	}

	function getTagObject( $tag )
	{
		return $this->cloneSettings( $this->getProcessor()->getTagObject( $tag ) );
	}

	function getArgs()
	{
		return $this->getArgsParser()->parse( $this->getBody() );
	}

	function getArgsParser()
	{
		static $parser;

		if ( $parser == null )
		{
			$parser = new Cat_ArgsParser_Common();
		}

		return $parser;
	}
}

?>
